3.2.55 \(\int \frac {(d+e x)^2 (f+g x+h x^2)}{(a+b x+c x^2)^2} \, dx\) [155]

3.2.55.1 Optimal result
3.2.55.2 Mathematica [A] (verified)
3.2.55.3 Rubi [A] (verified)
3.2.55.4 Maple [B] (verified)
3.2.55.5 Fricas [B] (verification not implemented)
3.2.55.6 Sympy [B] (verification not implemented)
3.2.55.7 Maxima [F(-2)]
3.2.55.8 Giac [A] (verification not implemented)
3.2.55.9 Mupad [B] (verification not implemented)

3.2.55.1 Optimal result

Integrand size = 30, antiderivative size = 288 \[ \int \frac {(d+e x)^2 \left (f+g x+h x^2\right )}{\left (a+b x+c x^2\right )^2} \, dx=\frac {e^2 \left (2 c^2 f-b c g+2 b^2 h-6 a c h\right ) x}{c^2 \left (b^2-4 a c\right )}+\frac {(d+e x)^2 \left (c \left (2 a g-b \left (f+\frac {a h}{c}\right )\right )-\left (2 c^2 f-b c g+b^2 h-2 a c h\right ) x\right )}{c \left (b^2-4 a c\right ) \left (a+b x+c x^2\right )}+\frac {\left (4 c^4 d^2 f-2 b^4 e^2 h-6 a c^2 e (b e g+2 b d h+2 a e h)+b^2 c e (b e g+2 b d h+12 a e h)-c^3 \left (2 b d (2 e f+d g)-4 a \left (e^2 f+2 d e g+d^2 h\right )\right )\right ) \text {arctanh}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )}{c^3 \left (b^2-4 a c\right )^{3/2}}+\frac {e (c e g+2 c d h-2 b e h) \log \left (a+b x+c x^2\right )}{2 c^3} \]

output
e^2*(2*c^2*f+2*b^2*h-c*(6*a*h+b*g))*x/c^2/(-4*a*c+b^2)+(e*x+d)^2*(c*(2*a*g 
-b*(f+a*h/c))-(-2*a*c*h+b^2*h-b*c*g+2*c^2*f)*x)/c/(-4*a*c+b^2)/(c*x^2+b*x+ 
a)+(4*c^4*d^2*f-2*b^4*e^2*h-6*a*c^2*e*(2*a*e*h+2*b*d*h+b*e*g)+b^2*c*e*(12* 
a*e*h+2*b*d*h+b*e*g)-c^3*(2*b*d*(d*g+2*e*f)-4*a*(d^2*h+2*d*e*g+e^2*f)))*ar 
ctanh((2*c*x+b)/(-4*a*c+b^2)^(1/2))/c^3/(-4*a*c+b^2)^(3/2)+1/2*e*(-2*b*e*h 
+2*c*d*h+c*e*g)*ln(c*x^2+b*x+a)/c^3
 
3.2.55.2 Mathematica [A] (verified)

Time = 0.48 (sec) , antiderivative size = 398, normalized size of antiderivative = 1.38 \[ \int \frac {(d+e x)^2 \left (f+g x+h x^2\right )}{\left (a+b x+c x^2\right )^2} \, dx=\frac {2 c e^2 h x-\frac {2 \left (b^4 e^2 h x+b^3 e (a e h-c (e g+2 d h) x)+b^2 c \left (c \left (e^2 f+2 d e g+d^2 h\right ) x-a e (e g+2 d h+4 e h x)\right )+2 c^2 \left (c^2 d^2 f x-a c \left (e^2 f x+2 d e (f+g x)+d^2 (g+h x)\right )+a^2 e (2 d h+e (g+h x))\right )+b c \left (-3 a^2 e^2 h+c^2 d (-2 e f x+d (f-g x))+a c \left (d^2 h+e^2 (f+3 g x)+2 d e (g+3 h x)\right )\right )\right )}{\left (b^2-4 a c\right ) (a+x (b+c x))}+\frac {2 \left (4 c^4 d^2 f-2 b^4 e^2 h-6 a c^2 e (b e g+2 b d h+2 a e h)+b^2 c e (b e g+2 b d h+12 a e h)+c^3 \left (-2 b d (2 e f+d g)+4 a \left (e^2 f+2 d e g+d^2 h\right )\right )\right ) \arctan \left (\frac {b+2 c x}{\sqrt {-b^2+4 a c}}\right )}{\left (-b^2+4 a c\right )^{3/2}}+e (c e g+2 c d h-2 b e h) \log (a+x (b+c x))}{2 c^3} \]

input
Integrate[((d + e*x)^2*(f + g*x + h*x^2))/(a + b*x + c*x^2)^2,x]
 
output
(2*c*e^2*h*x - (2*(b^4*e^2*h*x + b^3*e*(a*e*h - c*(e*g + 2*d*h)*x) + b^2*c 
*(c*(e^2*f + 2*d*e*g + d^2*h)*x - a*e*(e*g + 2*d*h + 4*e*h*x)) + 2*c^2*(c^ 
2*d^2*f*x - a*c*(e^2*f*x + 2*d*e*(f + g*x) + d^2*(g + h*x)) + a^2*e*(2*d*h 
 + e*(g + h*x))) + b*c*(-3*a^2*e^2*h + c^2*d*(-2*e*f*x + d*(f - g*x)) + a* 
c*(d^2*h + e^2*(f + 3*g*x) + 2*d*e*(g + 3*h*x)))))/((b^2 - 4*a*c)*(a + x*( 
b + c*x))) + (2*(4*c^4*d^2*f - 2*b^4*e^2*h - 6*a*c^2*e*(b*e*g + 2*b*d*h + 
2*a*e*h) + b^2*c*e*(b*e*g + 2*b*d*h + 12*a*e*h) + c^3*(-2*b*d*(2*e*f + d*g 
) + 4*a*(e^2*f + 2*d*e*g + d^2*h)))*ArcTan[(b + 2*c*x)/Sqrt[-b^2 + 4*a*c]] 
)/(-b^2 + 4*a*c)^(3/2) + e*(c*e*g + 2*c*d*h - 2*b*e*h)*Log[a + x*(b + c*x) 
])/(2*c^3)
 
3.2.55.3 Rubi [A] (verified)

Time = 0.77 (sec) , antiderivative size = 301, normalized size of antiderivative = 1.05, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.100, Rules used = {2175, 1200, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {(d+e x)^2 \left (f+g x+h x^2\right )}{\left (a+b x+c x^2\right )^2} \, dx\)

\(\Big \downarrow \) 2175

\(\displaystyle \frac {(d+e x)^2 \left (c \left (2 a g-b \left (\frac {a h}{c}+f\right )\right )-x \left (-2 a c h+b^2 h-b c g+2 c^2 f\right )\right )}{c \left (b^2-4 a c\right ) \left (a+b x+c x^2\right )}-\frac {\int \frac {(d+e x) \left (2 c d f-2 b e f-b d g+4 a e g+2 a d h-\frac {2 a b e h}{c}-e \left (\frac {2 h b^2}{c}-g b+2 c f-6 a h\right ) x\right )}{c x^2+b x+a}dx}{b^2-4 a c}\)

\(\Big \downarrow \) 1200

\(\displaystyle \frac {(d+e x)^2 \left (c \left (2 a g-b \left (\frac {a h}{c}+f\right )\right )-x \left (-2 a c h+b^2 h-b c g+2 c^2 f\right )\right )}{c \left (b^2-4 a c\right ) \left (a+b x+c x^2\right )}-\frac {\int \left (\frac {2 d^2 f c^3-\left (b d (2 e f+d g)-2 a \left (h d^2+2 e g d+e^2 f\right )\right ) c^2-a e (b e g+2 b d h+6 a e h) c+2 a b^2 e^2 h-\left (b^2-4 a c\right ) e (c e g+2 c d h-2 b e h) x}{c^2 \left (c x^2+b x+a\right )}-\frac {e^2 \left (2 h b^2-c g b+2 c^2 f-6 a c h\right )}{c^2}\right )dx}{b^2-4 a c}\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {(d+e x)^2 \left (c \left (2 a g-b \left (\frac {a h}{c}+f\right )\right )-x \left (-2 a c h+b^2 h-b c g+2 c^2 f\right )\right )}{c \left (b^2-4 a c\right ) \left (a+b x+c x^2\right )}-\frac {-\frac {\text {arctanh}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right ) \left (b^2 c e (12 a e h+2 b d h+b e g)-c^3 \left (2 b d (d g+2 e f)-4 a \left (d^2 h+2 d e g+e^2 f\right )\right )-6 a c^2 e (2 a e h+2 b d h+b e g)-2 b^4 e^2 h+4 c^4 d^2 f\right )}{c^3 \sqrt {b^2-4 a c}}-\frac {e \left (b^2-4 a c\right ) \log \left (a+b x+c x^2\right ) (-2 b e h+2 c d h+c e g)}{2 c^3}-\frac {e^2 x \left (-6 a c h+2 b^2 h-b c g+2 c^2 f\right )}{c^2}}{b^2-4 a c}\)

input
Int[((d + e*x)^2*(f + g*x + h*x^2))/(a + b*x + c*x^2)^2,x]
 
output
((d + e*x)^2*(c*(2*a*g - b*(f + (a*h)/c)) - (2*c^2*f - b*c*g + b^2*h - 2*a 
*c*h)*x))/(c*(b^2 - 4*a*c)*(a + b*x + c*x^2)) - (-((e^2*(2*c^2*f - b*c*g + 
 2*b^2*h - 6*a*c*h)*x)/c^2) - ((4*c^4*d^2*f - 2*b^4*e^2*h - 6*a*c^2*e*(b*e 
*g + 2*b*d*h + 2*a*e*h) + b^2*c*e*(b*e*g + 2*b*d*h + 12*a*e*h) - c^3*(2*b* 
d*(2*e*f + d*g) - 4*a*(e^2*f + 2*d*e*g + d^2*h)))*ArcTanh[(b + 2*c*x)/Sqrt 
[b^2 - 4*a*c]])/(c^3*Sqrt[b^2 - 4*a*c]) - ((b^2 - 4*a*c)*e*(c*e*g + 2*c*d* 
h - 2*b*e*h)*Log[a + b*x + c*x^2])/(2*c^3))/(b^2 - 4*a*c)
 

3.2.55.3.1 Defintions of rubi rules used

rule 1200
Int[(((d_.) + (e_.)*(x_))^(m_.)*((f_.) + (g_.)*(x_))^(n_.))/((a_.) + (b_.)* 
(x_) + (c_.)*(x_)^2), x_Symbol] :> Int[ExpandIntegrand[(d + e*x)^m*((f + g* 
x)^n/(a + b*x + c*x^2)), x], x] /; FreeQ[{a, b, c, d, e, f, g, m}, x] && In 
tegersQ[n]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 2175
Int[(Pq_)*((d_.) + (e_.)*(x_))^(m_.)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p 
_), x_Symbol] :> With[{Qx = PolynomialQuotient[Pq, a + b*x + c*x^2, x], R = 
 Coeff[PolynomialRemainder[Pq, a + b*x + c*x^2, x], x, 0], S = Coeff[Polyno 
mialRemainder[Pq, a + b*x + c*x^2, x], x, 1]}, Simp[(d + e*x)^m*(a + b*x + 
c*x^2)^(p + 1)*((R*b - 2*a*S + (2*c*R - b*S)*x)/((p + 1)*(b^2 - 4*a*c))), x 
] + Simp[1/((p + 1)*(b^2 - 4*a*c))   Int[(d + e*x)^(m - 1)*(a + b*x + c*x^2 
)^(p + 1)*ExpandToSum[(p + 1)*(b^2 - 4*a*c)*(d + e*x)*Qx + S*(2*a*e*m + b*d 
*(2*p + 3)) - R*(b*e*m + 2*c*d*(2*p + 3)) - e*(2*c*R - b*S)*(m + 2*p + 3)*x 
, x], x], x]] /; FreeQ[{a, b, c, d, e}, x] && PolyQ[Pq, x] && NeQ[b^2 - 4*a 
*c, 0] && NeQ[c*d^2 - b*d*e + a*e^2, 0] && LtQ[p, -1] && GtQ[m, 0] && (Inte 
gerQ[p] ||  !IntegerQ[m] ||  !RationalQ[a, b, c, d, e]) &&  !(IGtQ[m, 0] && 
 RationalQ[a, b, c, d, e] && (IntegerQ[p] || ILtQ[p + 1/2, 0]))
 
3.2.55.4 Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(627\) vs. \(2(283)=566\).

Time = 0.77 (sec) , antiderivative size = 628, normalized size of antiderivative = 2.18

method result size
default \(\frac {h \,e^{2} x}{c^{2}}-\frac {\frac {-\frac {\left (2 a^{2} c^{2} e^{2} h -4 a \,b^{2} c \,e^{2} h +6 a b \,c^{2} d e h +3 a b \,c^{2} e^{2} g -2 a \,c^{3} d^{2} h -4 a \,c^{3} d e g -2 a \,c^{3} e^{2} f +b^{4} e^{2} h -2 b^{3} c d e h -b^{3} c \,e^{2} g +b^{2} c^{2} d^{2} h +2 b^{2} c^{2} d e g +b^{2} c^{2} e^{2} f -b \,c^{3} d^{2} g -2 b \,c^{3} d e f +2 c^{4} d^{2} f \right ) x}{c \left (4 a c -b^{2}\right )}+\frac {3 a^{2} b c \,e^{2} h -4 a^{2} c^{2} d e h -2 a^{2} c^{2} e^{2} g -a \,b^{3} e^{2} h +2 a \,b^{2} c d e h +a \,b^{2} c \,e^{2} g -a b \,c^{2} d^{2} h -2 a b \,c^{2} d e g -a b \,c^{2} e^{2} f +2 a \,c^{3} d^{2} g +4 a \,c^{3} d e f -b \,c^{3} d^{2} f}{c \left (4 a c -b^{2}\right )}}{c \,x^{2}+b x +a}+\frac {\frac {\left (8 a b c \,e^{2} h -8 a \,c^{2} d h e -4 a \,c^{2} e^{2} g -2 b^{3} e^{2} h +2 b^{2} c d e h +b^{2} c \,e^{2} g \right ) \ln \left (c \,x^{2}+b x +a \right )}{2 c}+\frac {2 \left (6 a^{2} c \,e^{2} h -2 a \,b^{2} e^{2} h +2 a b c d e h +a b c \,e^{2} g -2 a \,c^{2} d^{2} h -4 a \,c^{2} d e g -2 a \,c^{2} e^{2} f +b \,c^{2} d^{2} g +2 b \,c^{2} d e f -2 c^{3} d^{2} f -\frac {\left (8 a b c \,e^{2} h -8 a \,c^{2} d h e -4 a \,c^{2} e^{2} g -2 b^{3} e^{2} h +2 b^{2} c d e h +b^{2} c \,e^{2} g \right ) b}{2 c}\right ) \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}}}{4 a c -b^{2}}}{c^{2}}\) \(628\)
risch \(\text {Expression too large to display}\) \(12206\)

input
int((e*x+d)^2*(h*x^2+g*x+f)/(c*x^2+b*x+a)^2,x,method=_RETURNVERBOSE)
 
output
h*e^2/c^2*x-1/c^2*((-(2*a^2*c^2*e^2*h-4*a*b^2*c*e^2*h+6*a*b*c^2*d*e*h+3*a* 
b*c^2*e^2*g-2*a*c^3*d^2*h-4*a*c^3*d*e*g-2*a*c^3*e^2*f+b^4*e^2*h-2*b^3*c*d* 
e*h-b^3*c*e^2*g+b^2*c^2*d^2*h+2*b^2*c^2*d*e*g+b^2*c^2*e^2*f-b*c^3*d^2*g-2* 
b*c^3*d*e*f+2*c^4*d^2*f)/c/(4*a*c-b^2)*x+(3*a^2*b*c*e^2*h-4*a^2*c^2*d*e*h- 
2*a^2*c^2*e^2*g-a*b^3*e^2*h+2*a*b^2*c*d*e*h+a*b^2*c*e^2*g-a*b*c^2*d^2*h-2* 
a*b*c^2*d*e*g-a*b*c^2*e^2*f+2*a*c^3*d^2*g+4*a*c^3*d*e*f-b*c^3*d^2*f)/c/(4* 
a*c-b^2))/(c*x^2+b*x+a)+1/(4*a*c-b^2)*(1/2*(8*a*b*c*e^2*h-8*a*c^2*d*e*h-4* 
a*c^2*e^2*g-2*b^3*e^2*h+2*b^2*c*d*e*h+b^2*c*e^2*g)/c*ln(c*x^2+b*x+a)+2*(6* 
a^2*c*e^2*h-2*a*b^2*e^2*h+2*a*b*c*d*e*h+a*b*c*e^2*g-2*a*c^2*d^2*h-4*a*c^2* 
d*e*g-2*a*c^2*e^2*f+b*c^2*d^2*g+2*b*c^2*d*e*f-2*c^3*d^2*f-1/2*(8*a*b*c*e^2 
*h-8*a*c^2*d*e*h-4*a*c^2*e^2*g-2*b^3*e^2*h+2*b^2*c*d*e*h+b^2*c*e^2*g)*b/c) 
/(4*a*c-b^2)^(1/2)*arctan((2*c*x+b)/(4*a*c-b^2)^(1/2))))
 
3.2.55.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 1376 vs. \(2 (281) = 562\).

Time = 0.55 (sec) , antiderivative size = 2771, normalized size of antiderivative = 9.62 \[ \int \frac {(d+e x)^2 \left (f+g x+h x^2\right )}{\left (a+b x+c x^2\right )^2} \, dx=\text {Too large to display} \]

input
integrate((e*x+d)^2*(h*x^2+g*x+f)/(c*x^2+b*x+a)^2,x, algorithm="fricas")
 
output
[1/2*(2*(b^4*c^2 - 8*a*b^2*c^3 + 16*a^2*c^4)*e^2*h*x^3 + 2*(b^5*c - 8*a*b^ 
3*c^2 + 16*a^2*b*c^3)*e^2*h*x^2 + ((4*(c^5*d^2 - b*c^4*d*e + a*c^4*e^2)*f 
- (2*b*c^4*d^2 - 8*a*c^4*d*e - (b^3*c^2 - 6*a*b*c^3)*e^2)*g + 2*(2*a*c^4*d 
^2 + (b^3*c^2 - 6*a*b*c^3)*d*e - (b^4*c - 6*a*b^2*c^2 + 6*a^2*c^3)*e^2)*h) 
*x^2 + 4*(a*c^4*d^2 - a*b*c^3*d*e + a^2*c^3*e^2)*f - (2*a*b*c^3*d^2 - 8*a^ 
2*c^3*d*e - (a*b^3*c - 6*a^2*b*c^2)*e^2)*g + 2*(2*a^2*c^3*d^2 + (a*b^3*c - 
 6*a^2*b*c^2)*d*e - (a*b^4 - 6*a^2*b^2*c + 6*a^3*c^2)*e^2)*h + (4*(b*c^4*d 
^2 - b^2*c^3*d*e + a*b*c^3*e^2)*f - (2*b^2*c^3*d^2 - 8*a*b*c^3*d*e - (b^4* 
c - 6*a*b^2*c^2)*e^2)*g + 2*(2*a*b*c^3*d^2 + (b^4*c - 6*a*b^2*c^2)*d*e - ( 
b^5 - 6*a*b^3*c + 6*a^2*b*c^2)*e^2)*h)*x)*sqrt(b^2 - 4*a*c)*log((2*c^2*x^2 
 + 2*b*c*x + b^2 - 2*a*c + sqrt(b^2 - 4*a*c)*(2*c*x + b))/(c*x^2 + b*x + a 
)) - 2*((b^3*c^3 - 4*a*b*c^4)*d^2 - 4*(a*b^2*c^3 - 4*a^2*c^4)*d*e + (a*b^3 
*c^2 - 4*a^2*b*c^3)*e^2)*f + 2*(2*(a*b^2*c^3 - 4*a^2*c^4)*d^2 - 2*(a*b^3*c 
^2 - 4*a^2*b*c^3)*d*e + (a*b^4*c - 6*a^2*b^2*c^2 + 8*a^3*c^3)*e^2)*g - 2*( 
(a*b^3*c^2 - 4*a^2*b*c^3)*d^2 - 2*(a*b^4*c - 6*a^2*b^2*c^2 + 8*a^3*c^3)*d* 
e + (a*b^5 - 7*a^2*b^3*c + 12*a^3*b*c^2)*e^2)*h - 2*((2*(b^2*c^4 - 4*a*c^5 
)*d^2 - 2*(b^3*c^3 - 4*a*b*c^4)*d*e + (b^4*c^2 - 6*a*b^2*c^3 + 8*a^2*c^4)* 
e^2)*f - ((b^3*c^3 - 4*a*b*c^4)*d^2 - 2*(b^4*c^2 - 6*a*b^2*c^3 + 8*a^2*c^4 
)*d*e + (b^5*c - 7*a*b^3*c^2 + 12*a^2*b*c^3)*e^2)*g + ((b^4*c^2 - 6*a*b^2* 
c^3 + 8*a^2*c^4)*d^2 - 2*(b^5*c - 7*a*b^3*c^2 + 12*a^2*b*c^3)*d*e + (b^...
 
3.2.55.6 Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 2966 vs. \(2 (291) = 582\).

Time = 156.09 (sec) , antiderivative size = 2966, normalized size of antiderivative = 10.30 \[ \int \frac {(d+e x)^2 \left (f+g x+h x^2\right )}{\left (a+b x+c x^2\right )^2} \, dx=\text {Too large to display} \]

input
integrate((e*x+d)**2*(h*x**2+g*x+f)/(c*x**2+b*x+a)**2,x)
 
output
(-e*(2*b*e*h - 2*c*d*h - c*e*g)/(2*c**3) - sqrt(-(4*a*c - b**2)**3)*(12*a* 
*2*c**2*e**2*h - 12*a*b**2*c*e**2*h + 12*a*b*c**2*d*e*h + 6*a*b*c**2*e**2* 
g - 4*a*c**3*d**2*h - 8*a*c**3*d*e*g - 4*a*c**3*e**2*f + 2*b**4*e**2*h - 2 
*b**3*c*d*e*h - b**3*c*e**2*g + 2*b*c**3*d**2*g + 4*b*c**3*d*e*f - 4*c**4* 
d**2*f)/(2*c**3*(64*a**3*c**3 - 48*a**2*b**2*c**2 + 12*a*b**4*c - b**6)))* 
log(x + (-10*a**2*b*c*e**2*h - 16*a**2*c**4*(-e*(2*b*e*h - 2*c*d*h - c*e*g 
)/(2*c**3) - sqrt(-(4*a*c - b**2)**3)*(12*a**2*c**2*e**2*h - 12*a*b**2*c*e 
**2*h + 12*a*b*c**2*d*e*h + 6*a*b*c**2*e**2*g - 4*a*c**3*d**2*h - 8*a*c**3 
*d*e*g - 4*a*c**3*e**2*f + 2*b**4*e**2*h - 2*b**3*c*d*e*h - b**3*c*e**2*g 
+ 2*b*c**3*d**2*g + 4*b*c**3*d*e*f - 4*c**4*d**2*f)/(2*c**3*(64*a**3*c**3 
- 48*a**2*b**2*c**2 + 12*a*b**4*c - b**6))) + 16*a**2*c**2*d*e*h + 8*a**2* 
c**2*e**2*g + 2*a*b**3*e**2*h + 8*a*b**2*c**3*(-e*(2*b*e*h - 2*c*d*h - c*e 
*g)/(2*c**3) - sqrt(-(4*a*c - b**2)**3)*(12*a**2*c**2*e**2*h - 12*a*b**2*c 
*e**2*h + 12*a*b*c**2*d*e*h + 6*a*b*c**2*e**2*g - 4*a*c**3*d**2*h - 8*a*c* 
*3*d*e*g - 4*a*c**3*e**2*f + 2*b**4*e**2*h - 2*b**3*c*d*e*h - b**3*c*e**2* 
g + 2*b*c**3*d**2*g + 4*b*c**3*d*e*f - 4*c**4*d**2*f)/(2*c**3*(64*a**3*c** 
3 - 48*a**2*b**2*c**2 + 12*a*b**4*c - b**6))) - 2*a*b**2*c*d*e*h - a*b**2* 
c*e**2*g - 2*a*b*c**2*d**2*h - 4*a*b*c**2*d*e*g - 2*a*b*c**2*e**2*f - b**4 
*c**2*(-e*(2*b*e*h - 2*c*d*h - c*e*g)/(2*c**3) - sqrt(-(4*a*c - b**2)**3)* 
(12*a**2*c**2*e**2*h - 12*a*b**2*c*e**2*h + 12*a*b*c**2*d*e*h + 6*a*b*c...
 
3.2.55.7 Maxima [F(-2)]

Exception generated. \[ \int \frac {(d+e x)^2 \left (f+g x+h x^2\right )}{\left (a+b x+c x^2\right )^2} \, dx=\text {Exception raised: ValueError} \]

input
integrate((e*x+d)^2*(h*x^2+g*x+f)/(c*x^2+b*x+a)^2,x, algorithm="maxima")
 
output
Exception raised: ValueError >> Computation failed since Maxima requested 
additional constraints; using the 'assume' command before evaluation *may* 
 help (example of legal syntax is 'assume(4*a*c-b^2>0)', see `assume?` for 
 more deta
 
3.2.55.8 Giac [A] (verification not implemented)

Time = 0.27 (sec) , antiderivative size = 547, normalized size of antiderivative = 1.90 \[ \int \frac {(d+e x)^2 \left (f+g x+h x^2\right )}{\left (a+b x+c x^2\right )^2} \, dx=\frac {e^{2} h x}{c^{2}} - \frac {{\left (4 \, c^{4} d^{2} f - 4 \, b c^{3} d e f + 4 \, a c^{3} e^{2} f - 2 \, b c^{3} d^{2} g + 8 \, a c^{3} d e g + b^{3} c e^{2} g - 6 \, a b c^{2} e^{2} g + 4 \, a c^{3} d^{2} h + 2 \, b^{3} c d e h - 12 \, a b c^{2} d e h - 2 \, b^{4} e^{2} h + 12 \, a b^{2} c e^{2} h - 12 \, a^{2} c^{2} e^{2} h\right )} \arctan \left (\frac {2 \, c x + b}{\sqrt {-b^{2} + 4 \, a c}}\right )}{{\left (b^{2} c^{3} - 4 \, a c^{4}\right )} \sqrt {-b^{2} + 4 \, a c}} + \frac {{\left (c e^{2} g + 2 \, c d e h - 2 \, b e^{2} h\right )} \log \left (c x^{2} + b x + a\right )}{2 \, c^{3}} - \frac {\frac {{\left (2 \, c^{4} d^{2} f - 2 \, b c^{3} d e f + b^{2} c^{2} e^{2} f - 2 \, a c^{3} e^{2} f - b c^{3} d^{2} g + 2 \, b^{2} c^{2} d e g - 4 \, a c^{3} d e g - b^{3} c e^{2} g + 3 \, a b c^{2} e^{2} g + b^{2} c^{2} d^{2} h - 2 \, a c^{3} d^{2} h - 2 \, b^{3} c d e h + 6 \, a b c^{2} d e h + b^{4} e^{2} h - 4 \, a b^{2} c e^{2} h + 2 \, a^{2} c^{2} e^{2} h\right )} x}{c} + \frac {b c^{3} d^{2} f - 4 \, a c^{3} d e f + a b c^{2} e^{2} f - 2 \, a c^{3} d^{2} g + 2 \, a b c^{2} d e g - a b^{2} c e^{2} g + 2 \, a^{2} c^{2} e^{2} g + a b c^{2} d^{2} h - 2 \, a b^{2} c d e h + 4 \, a^{2} c^{2} d e h + a b^{3} e^{2} h - 3 \, a^{2} b c e^{2} h}{c}}{{\left (c x^{2} + b x + a\right )} {\left (b^{2} - 4 \, a c\right )} c^{2}} \]

input
integrate((e*x+d)^2*(h*x^2+g*x+f)/(c*x^2+b*x+a)^2,x, algorithm="giac")
 
output
e^2*h*x/c^2 - (4*c^4*d^2*f - 4*b*c^3*d*e*f + 4*a*c^3*e^2*f - 2*b*c^3*d^2*g 
 + 8*a*c^3*d*e*g + b^3*c*e^2*g - 6*a*b*c^2*e^2*g + 4*a*c^3*d^2*h + 2*b^3*c 
*d*e*h - 12*a*b*c^2*d*e*h - 2*b^4*e^2*h + 12*a*b^2*c*e^2*h - 12*a^2*c^2*e^ 
2*h)*arctan((2*c*x + b)/sqrt(-b^2 + 4*a*c))/((b^2*c^3 - 4*a*c^4)*sqrt(-b^2 
 + 4*a*c)) + 1/2*(c*e^2*g + 2*c*d*e*h - 2*b*e^2*h)*log(c*x^2 + b*x + a)/c^ 
3 - ((2*c^4*d^2*f - 2*b*c^3*d*e*f + b^2*c^2*e^2*f - 2*a*c^3*e^2*f - b*c^3* 
d^2*g + 2*b^2*c^2*d*e*g - 4*a*c^3*d*e*g - b^3*c*e^2*g + 3*a*b*c^2*e^2*g + 
b^2*c^2*d^2*h - 2*a*c^3*d^2*h - 2*b^3*c*d*e*h + 6*a*b*c^2*d*e*h + b^4*e^2* 
h - 4*a*b^2*c*e^2*h + 2*a^2*c^2*e^2*h)*x/c + (b*c^3*d^2*f - 4*a*c^3*d*e*f 
+ a*b*c^2*e^2*f - 2*a*c^3*d^2*g + 2*a*b*c^2*d*e*g - a*b^2*c*e^2*g + 2*a^2* 
c^2*e^2*g + a*b*c^2*d^2*h - 2*a*b^2*c*d*e*h + 4*a^2*c^2*d*e*h + a*b^3*e^2* 
h - 3*a^2*b*c*e^2*h)/c)/((c*x^2 + b*x + a)*(b^2 - 4*a*c)*c^2)
 
3.2.55.9 Mupad [B] (verification not implemented)

Time = 15.07 (sec) , antiderivative size = 742, normalized size of antiderivative = 2.58 \[ \int \frac {(d+e x)^2 \left (f+g x+h x^2\right )}{\left (a+b x+c x^2\right )^2} \, dx=\frac {\frac {-3\,h\,a^2\,b\,c\,e^2+4\,h\,a^2\,c^2\,d\,e+2\,g\,a^2\,c^2\,e^2+h\,a\,b^3\,e^2-2\,h\,a\,b^2\,c\,d\,e-g\,a\,b^2\,c\,e^2+h\,a\,b\,c^2\,d^2+2\,g\,a\,b\,c^2\,d\,e+f\,a\,b\,c^2\,e^2-2\,g\,a\,c^3\,d^2-4\,f\,a\,c^3\,d\,e+f\,b\,c^3\,d^2}{c\,\left (4\,a\,c-b^2\right )}+\frac {x\,\left (2\,h\,a^2\,c^2\,e^2-4\,h\,a\,b^2\,c\,e^2+6\,h\,a\,b\,c^2\,d\,e+3\,g\,a\,b\,c^2\,e^2-2\,h\,a\,c^3\,d^2-4\,g\,a\,c^3\,d\,e-2\,f\,a\,c^3\,e^2+h\,b^4\,e^2-2\,h\,b^3\,c\,d\,e-g\,b^3\,c\,e^2+h\,b^2\,c^2\,d^2+2\,g\,b^2\,c^2\,d\,e+f\,b^2\,c^2\,e^2-g\,b\,c^3\,d^2-2\,f\,b\,c^3\,d\,e+2\,f\,c^4\,d^2\right )}{c\,\left (4\,a\,c-b^2\right )}}{c^3\,x^2+b\,c^2\,x+a\,c^2}+\frac {\ln \left (c\,x^2+b\,x+a\right )\,\left (-128\,h\,a^3\,b\,c^3\,e^2+64\,g\,a^3\,c^4\,e^2+128\,d\,h\,a^3\,c^4\,e+96\,h\,a^2\,b^3\,c^2\,e^2-48\,g\,a^2\,b^2\,c^3\,e^2-96\,d\,h\,a^2\,b^2\,c^3\,e-24\,h\,a\,b^5\,c\,e^2+12\,g\,a\,b^4\,c^2\,e^2+24\,d\,h\,a\,b^4\,c^2\,e+2\,h\,b^7\,e^2-g\,b^6\,c\,e^2-2\,d\,h\,b^6\,c\,e\right )}{2\,\left (64\,a^3\,c^6-48\,a^2\,b^2\,c^5+12\,a\,b^4\,c^4-b^6\,c^3\right )}+\frac {\mathrm {atan}\left (\frac {2\,c\,x}{\sqrt {4\,a\,c-b^2}}-\frac {b^3\,c^2-4\,a\,b\,c^3}{c^2\,{\left (4\,a\,c-b^2\right )}^{3/2}}\right )\,\left (-12\,h\,a^2\,c^2\,e^2+12\,h\,a\,b^2\,c\,e^2-12\,h\,a\,b\,c^2\,d\,e-6\,g\,a\,b\,c^2\,e^2+4\,h\,a\,c^3\,d^2+8\,g\,a\,c^3\,d\,e+4\,f\,a\,c^3\,e^2-2\,h\,b^4\,e^2+2\,h\,b^3\,c\,d\,e+g\,b^3\,c\,e^2-2\,g\,b\,c^3\,d^2-4\,f\,b\,c^3\,d\,e+4\,f\,c^4\,d^2\right )}{c^3\,{\left (4\,a\,c-b^2\right )}^{3/2}}+\frac {e^2\,h\,x}{c^2} \]

input
int(((d + e*x)^2*(f + g*x + h*x^2))/(a + b*x + c*x^2)^2,x)
 
output
((2*a^2*c^2*e^2*g - 2*a*c^3*d^2*g + b*c^3*d^2*f + a*b^3*e^2*h + a*b*c^2*e^ 
2*f + a*b*c^2*d^2*h - a*b^2*c*e^2*g - 3*a^2*b*c*e^2*h + 4*a^2*c^2*d*e*h - 
4*a*c^3*d*e*f + 2*a*b*c^2*d*e*g - 2*a*b^2*c*d*e*h)/(c*(4*a*c - b^2)) + (x* 
(2*c^4*d^2*f + b^4*e^2*h + b^2*c^2*e^2*f + 2*a^2*c^2*e^2*h + b^2*c^2*d^2*h 
 - 2*a*c^3*e^2*f - 2*a*c^3*d^2*h - b*c^3*d^2*g - b^3*c*e^2*g + 3*a*b*c^2*e 
^2*g - 4*a*b^2*c*e^2*h + 2*b^2*c^2*d*e*g - 4*a*c^3*d*e*g - 2*b*c^3*d*e*f - 
 2*b^3*c*d*e*h + 6*a*b*c^2*d*e*h))/(c*(4*a*c - b^2)))/(a*c^2 + c^3*x^2 + b 
*c^2*x) + (log(a + b*x + c*x^2)*(2*b^7*e^2*h + 64*a^3*c^4*e^2*g - b^6*c*e^ 
2*g - 24*a*b^5*c*e^2*h + 128*a^3*c^4*d*e*h + 12*a*b^4*c^2*e^2*g - 128*a^3* 
b*c^3*e^2*h - 2*b^6*c*d*e*h - 48*a^2*b^2*c^3*e^2*g + 96*a^2*b^3*c^2*e^2*h 
+ 24*a*b^4*c^2*d*e*h - 96*a^2*b^2*c^3*d*e*h))/(2*(64*a^3*c^6 - b^6*c^3 + 1 
2*a*b^4*c^4 - 48*a^2*b^2*c^5)) + (atan((2*c*x)/(4*a*c - b^2)^(1/2) - (b^3* 
c^2 - 4*a*b*c^3)/(c^2*(4*a*c - b^2)^(3/2)))*(4*c^4*d^2*f - 2*b^4*e^2*h - 1 
2*a^2*c^2*e^2*h + 4*a*c^3*e^2*f + 4*a*c^3*d^2*h - 2*b*c^3*d^2*g + b^3*c*e^ 
2*g - 6*a*b*c^2*e^2*g + 12*a*b^2*c*e^2*h + 8*a*c^3*d*e*g - 4*b*c^3*d*e*f + 
 2*b^3*c*d*e*h - 12*a*b*c^2*d*e*h))/(c^3*(4*a*c - b^2)^(3/2)) + (e^2*h*x)/ 
c^2